import { dayjs } from 'element-plus';

export const useIndexArticles = defineStore('indexArticles', () => {
  const indexArticles = ref<IndexArticles[]>([]);
  const getIndexArticles = async () => {
    if (indexArticles.value.length <= 0) {
      const list = await get_index_articles();
      if (list) {
        indexArticles.value = list;
      }
      // console.log('getIndexArticles', list);
    }
    return indexArticles.value;
  };
  return {
    indexArticles,
    getIndexArticles,
  };
});
